vcMaterial
Material is a material used by geometry and solid shapes in the 3D world.
See in: Overview
Module: vcCore
Parent: vcObject
Children -
Referenced by: vcAnnotation.Material, vcApplication.Materials, vcApplication.createMaterial(), vcApplication.findMaterial(), ... (see more)
vcAnnotation.Material
vcApplication.Materials
vcApplication.createMaterial()
vcApplication.findMaterial()
vcBooleanFeature.Material
vcCollisionDetector.CollisionMaterial
vcCollisionDetector.NodeACollisionMaterial
vcCollisionDetector.NodeBCollisionMaterial
vcComponent.Material
vcDimension.Material
vcExtrudeFeature.Material
vcGeometrySet.Material
vcMaterialProperty.Value
vcNode.NodeMaterial
vcPrimitiveFeature.Material
vcRevolveFeature.Material
vcSetNodeMaterialStatement.Material
vcSweptVolume.Material
vcVolumeSensor.VolumeMaterial
Properties
Learn how to use properties here. The properties are also inherited from the parent class.
| Name | Type | Access | Description |
| Ambient | vcColor | RW | Defines a vector used for calculating the ambient value of the material. |
| ColorMask | vcMaterialColorMaskFlags | RW | Defines the RGB/RGBA color mask used for rendering the material. |
| DepthComparison | vcMaterialDepthComparison | RW | Controls the visibility of geometry See moreassigned to the material based on pixel depth (distance from camera) in comparison to a Z-axis buffer. |
| Diffuse | vcColor | RW | Defines a vector used for calculating diffuse reflection of light hitting the material. |
| Name | String | RW | Gets the name of the material. |
| Opacity | Real | RW | Gets or sets the opacity value of the material (1 is fully opaque, 0 is fully transparent). |
| OpacityType | vcMaterialOpacityType | RW | Gets or sets the opacity type used by the material. |
| RenderOrder | vcMaterialRenderOrder | RW | Defines the order in which geometry using this material is rendered in the 3D world. |
| Shininess | Real | RW | Defines the intensity of the light that's reflected from the material, thereby defining its luster. |
| Specular | vcColor | RW | Defines a vector used for calculating the specular reflection of the light hitting the material. |
| Texture | vcBitmap | RW | Gets or sets the bitmap defining the texture of the material. |
Example: Inherit and Render Material
''' vcMaterial: Inherit and render material Please test component with multiple nodes, such as a six-axis articulated robot ''' import vcCore as vc app = vc.getApplication() comp = vc.getComponent() async def OnRun(): red_matte = app.findMaterial("red_matte") while True: comp.MaterialInheritance = vc.vcMaterialInheritance.DISABLED await vc.delay(1.0) comp.MaterialInheritance = vc.vcMaterialInheritance.FORCE_INHERIT_LEVEL comp.NodeMaterial = red_matte await vc.delay(1.0) comp.MaterialInheritance = vc.vcMaterialInheritance.FORCE_INHERIT_NODE comp.NodeMaterial = red_matte await vc.delay(1.0)
Example: Set Material Opacity
''' vcMaterial: Set material opacity ''' import vcCore as vc import vcFeatures as vc_fea vc_ft = vc_fea.vcFeatureType app = vc.getApplication() comp = vc.getComponent() def create_block(): block = comp.findFeature("Block") if not block: block = comp.RootFeature.create(vc_ft.BLOCK, "Block") comp.rebuild() def get_material(material_name): material = app.findMaterial(material_name) if not material: material = app.createMaterial(material_name) material.OpacityType = vc.vcMaterialOpacityType.CONSTANT return material async def OnRun(): create_block() material = get_material("MyMaterial") material.Ambient = vc.vcColor(1.0, 0.0, 0.0) material.Opacity = 1.0 while True: for level_index in range(256): level = 1.0 - level_index * (1.0 / 256.0) material.Opacity = level comp.Material = material await vc.delay(0.01) for level_index in range(256): level = level_index * (1.0 / 256.0) material.Opacity = level comp.Material = material await vc.delay(0.01)